﻿using System;
using System.Collections;
using DG.Tweening;
using UnityEngine;

public class AttackPurpose : Purpose
{

    public override string Text => $"攻击 {attackAmount}";

    public int attackAmount { set; get; } = 0;

    public override IEnumerator PurposePerformer()
    {
        Debug.Log($"敌人 {enemyView.name} 执行攻击");
        Tween tween = enemyView.transform.DOMoveX(enemyView.transform.position.x - 1f, 0.15f);
        yield return tween.WaitForCompletion();
        enemyView.transform.DOMoveX(enemyView.transform.position.x + 1f, 0.25f);
        DealDamageGA dealDamageGA = new(attackAmount, new() { HeroSystem.Instance.heroView });
        ActionSystem.Instance.AddReaction(dealDamageGA);
        yield return null;
    }
}